﻿<%@ Page Language="C#" MasterPageFile="~/masterPage/front/basePage.master" AutoEventWireup="true" CodeFile="NewsContent.aspx.cs" 
    Inherits="NewsContent" Title="联系我们---零件资源网" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script type="text/javascript">
    function change() {
        var imgNode = document.getElementById("vimg");
        imgNode.src = "CheckCode.ashx?t=" + (new Date()).valueOf(); //这里加个时间参数为了防止浏览器缓存问题
    }
</script>

<div id="newscontent" class="commonfrm">
    <h4><asp:Literal ID="litTitle" runat="server"></asp:Literal></h4>
    <p class="con">
    
    <asp:Literal ID="litContent" runat="server"></asp:Literal>
    </p>
    <p class="con_time">
        发布时间:<asp:Literal ID="litNewsTime" runat="server"></asp:Literal></p>
    <a href="#pl">我要评论</a>
</div>
<!--新闻评论-->
<div id="newsreplay" class="commonfrm">
    <h4>新闻评论</h4>
        <div id="emptypl" runat="server" style=" padding:10px;">
            <p>该新闻目前没有评论!</p>
        </div>
        <asp:Repeater ID="rptComment" runat="server" 
        onitemdatabound="rptComment_ItemDataBound">
            <ItemTemplate>
            <div class="replay">
            <p class="con">
                <%#Eval("Content")%>
            </p>
            <p class="replay_info">
                评论者:<%#Eval("UserIP").ToString().Substring(0, Eval("UserIP").ToString().LastIndexOf(".") + 1) + "*"%>评论时间:<%#Eval("CreateDate")%>　<asp:LinkButton ID="lbtnDel" Visible="false" CommandArgument='<%#Eval("CoID")%>' OnClick="LbtnDel_Click" runat="server" OnClientClick="return confirm('是否确定删除？');">删除</asp:LinkButton></p>
            <hr />
         </div>
            </ItemTemplate>
        </asp:Repeater>   
</div>
<!--评论书写区-->

<div class="addcomment">
    <asp:TextBox ID="txtComment" runat="server" TextMode="MultiLine" Text="请在些输入评论内容" CssClass="concomment"></asp:TextBox>
<p>验证码:<a name="pl">&nbsp;</a><img src="../controls/common/CheckCode.ashx" 
        id="vimg" alt="" />
<input type="button" value="换一张图片"  onclick="change()" /> 
    <asp:TextBox ID="txtCode" runat="server" CssClass="txtcode" MaxLength="6"></asp:TextBox>
    <asp:RequiredFieldValidator
        ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入验证码" Text="*" 
        ControlToValidate="txtCode" ValidationGroup="comment"></asp:RequiredFieldValidator>
    <asp:CustomValidator ID="CustomValidator1"
            runat="server" ErrorMessage="验证码错误" Display="Dynamic" text="验证码错误" 
        onservervalidate="CustomValidator1_ServerValidate" 
        ControlToValidate="txtCode" ValidationGroup="comment"></asp:CustomValidator>
    
    <p> <asp:Button ID="btnSubmit" runat="server" Text="提交评论" 
        onclick="btnSubmit_Click" ValidationGroup="comment" /></p>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
        ShowMessageBox="True" ShowSummary="False" DisplayMode="BulletList" 
        ValidationGroup="comment" />
</div>

   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        SelectCommand="SELECT TOP 20  FROM [XPNewsComment] C WHERE  C.NewsID = @NewsID ORDER BY  C.CreateDate DESC" >
    </asp:SqlDataSource>
</asp:Content>
